package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stone
 * @date 2022/12/23 11:23
 */
@RequestMapping("json")
//@Controller
//@ResponseBody
@RestController
public class JsonController {

    @RequestMapping("user")
    //@ResponseBody
    public User user() {
        User user = new User("张松", "远志", 30);

        return user;
    }

    @RequestMapping("vo")
    public BaseRespVo vo() {
        return BaseRespVo.ok("hello vo");//"hello vo" 作为BaseRespVo对象中的data的
    }
}
